use mysql::*;
use mysql_rust::user_db;

fn main() {
    let url = "mysql://root:123456@localhost:3308/hello";
    let pool = Pool::new(url).unwrap();

    println!("== SELECT ALL ==");
    let users = user_db::select_all(pool.get_conn().unwrap());
    for u in users {
        println!("{}, {},{},{}", u.id, u.name, u.age, u.email);
    }
    println!("== SELECT BY ID ==");
    let user = user_db::select_by_id(pool.get_conn().unwrap(), 1);
    match user.unwrap() {
        Some(u) => println!("{}, {},{},{}", u.id, u.name, u.age, u.email),
        None => println!("Sorry no student found."),
    }
}
